package com.example.oauth2.service;

import com.example.oauth2.domain.UserDomain;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
public class MyUserDetailsService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        if(username.equals("user_1")){
            UserDomain userDomain=new UserDomain();
            userDomain.setUsername(username);
            userDomain.setPassword("123456");
            return userDomain;
        }
        throw new UsernameNotFoundException(username);
    }
}
